package com.ziyuan.mapper;

import com.ziyuan.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface Usermapper {
@Select("select * from user where username = #{username}")
    public User Find(String username);
@Insert("insert into user(password,username,update_time,create_time) values (#{md5String},#{username},now(),now())")
    void register(String username, String md5String);
@Update("update user  set username = #{username},password = #{password},email = #{email},update_time = #{updateTime},nickname = #{nickname} where id = #{id}")
    void update(User user);
@Update("update user set update_time = now(),user_pic = #{avatarUrl} where id = #{id}")
    void image(String avatarUrl, Integer id);
@Update("update user set password = #{newPwd},update_time = now() where username = #{username}")
    void updatePwd(String newPwd, String username);
}
